package com.example.usermanage.tools;

import com.example.usermanage.model.Userinfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class GetSession {
    public static int getSession(HttpServletRequest request){
        //拦截器已经判断过登录状态,这里可以不用判断
        //拿到管理员标识
        return ((Userinfo)request.getSession().getAttribute("userinfo")).getIsadmin();
    }
    public static int getId(HttpServletRequest request){
        //拿到ID标识
        return ((Userinfo)request.getSession().getAttribute("userinfo")).getId();
    }
}
